package org.rcy.ruicingmarket.oss.user;


import lombok.Data;
import org.rcy.framework.api.entity.BaseEntity;
import org.rcy.framework.api.security.SecurityUser;
import org.rcy.framework.api.security.UserRolePrincipal;
import org.rcy.ruicingmarket.resource.ResourceGroup;
import org.rcy.ruicingmarket.oss.role.Role;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Collection;
import java.util.Date;
import java.util.Set;


/**
*
* @author RuicyWu
*@Date 2021-12-22 14:34:38
*/
@Data
@Table(name = "oss_user")
@Entity
public class OssUser extends BaseEntity implements SecurityUser, UserRolePrincipal {

	private String name; //用户名称

	private String account;

	private String password;

	private Date createTime;

	private Date lastLoginTime;

	private Date updateTime;

	private Boolean enabled;

	@Transient
	private Set<Role> ossRoles;
	@Transient
	private Set<ResourceGroup> resourceGroups;

	@Override
	public Boolean getEnabled() {
		return enabled;
	}

	@Override
	public Collection getGrantedRoles() {
		return this.ossRoles;
	}

	public void setEnabled(Boolean enabled) {
		this.enabled = enabled;
	}

}
